<template>
  <div id="app">
    <Header :title="'购物车'" />
    <List :cartList="item" v-for="item in cartList" :key="item.id"/>
    <Foot :cartList="cartList"/>
  </div>
</template>

<script>
import Header from './views/header.vue'
import List from './views/list.vue'
import Foot from './views/foot.vue'

export default {
  name: 'App',
  components: {
    Header,
    List,
    Foot
  },
  data () {
    return {
      cartList: []
    }
  },
  created () {
    this.getCral()
  },
  methods: {
    async getCral () {
      const { data } = await this.request({ url: '/api/cart' })
      console.log(data.list)
      this.cartList = data.list
    }
  }
}
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin: 45px 0 50px 0;
}
</style>
